#!/usr/bin/env ruby

require 'mcollective'

oparser = MCollective::Optionparser.new({}, "filter")

options = oparser.parse{|parser, options|
    parser.define_head "Find hosts matching criteria"
    parser.banner = "Usage: sh-find-hosts [options] [filters]"
}

begin
    client = MCollective::Client.new(options[:config])
    client.options = options

    stats = client.req("ping", "discovery") do |resp|
        puts resp[:senderid]
    end
rescue Exception => e
    raise
end

client.display_stats(stats) if options[:verbose]

# vi:tabstop=4:expandtab:ai
